/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1625476910226_9521';

  // 中间件的配置 --  注意中间件的名称要和middleware文件夹下的名称对应，而不是方法名
  config.middleware = [
    'printdate', 'forbidip', 'auth'
  ];

  // 中间件的传参
  config.printdate = {
    aaa: 'aaa'
  }
  config.forbidip = {
    forbidips: ['172.0.0.1', '127.20.10.2']
  }

  // 配置mongoose
  // config.mongoose = {
  //   url: 'mongodb://127.0.0.1:27002/egg-test-1',
  //   options: {
  //     useUnifiedTopology: true,
  //     useCreateIndex: true
  //   }
  // }

  // 配置模板引擎 -- 可以指定后缀名为 .html
  config.view = {
    mapping: {
      '.html': 'ejs',
    },
  };

  // 配置公共地址
  config.api = "http://www.phonegap100.com/"

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
